﻿@model IEnumerable<TinyForum.Web.Proxies.ServiceReference.TopicDetailDataObject>

@{
    ViewBag.Title = "Tiny Forum - Home";
}

<table>
    <tr>
        <th>
            Topic
        </th>
        <th>
            Total Posts
        </th>
        <th>
            Latest Reply
        </th>
    </tr>

@foreach (var item in Model) {
    <tr> 
        <td>
            <b>@Html.ActionLink(item.Topic.Name, "ListAllPosts", "Topic", new { id = item.Topic.ID }) </b><br />
            @Html.DisplayFor(modelItem => item.Topic.Description)
        </td>
        <td align="right">
            @Html.DisplayFor(modelItem => item.NumOfPosts)
        </td>
        <td align="center">
        @if (item.LatestReply != null)
        {
            @Html.Encode(item.LatestReply.User.UserName)
        }
        else
        { 
            @Html.Encode("-");
        }
        
        </td>
        @*<td>
            @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
            @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
            @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
        </td>*@
    </tr>
}

</table>
